<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function add(a=1,b=2){
            console.log(a+b);
        } 
        add()
        add(2)
        add(20,1)


        // 与解构赋值结合
        // host为默认值 
        function connect({host='124.34',username,password,port}){
            console.log(host);
            console.log(username);
            console.log(password);
            console.log(port);
        }

        connect({
            // host:'pink',
            username:'root',
            password:'root',
            port:3306
        })
    </script>
</body>
</html>